home *** CD-ROM | disk | FTP | other *** search
- Documentation for Version 5.2 of the ATSAYGET unit:
-
- The new AtSayGet procedures are built around a powerful LINE EDITOR with Word-
- Star (c) compatibility. These features give the functional equivalence of the
- dBase (c) @ Line,Row SAY 'prompt' GET <var> [PICTURE] [RANGE] command. Version
- 5.2 has 6 new procedures. The line editing keys have been expanded to hook into
- the FULL SCREEN EDITOR available in the included ReadASG unit.
- The AtSayGet unit interface follows:
-
- UNIT ATSAYGET;
-
- INTERFACE
-
- USES
- DOS,
- BlueBag;
-
- TYPE
- MaxFL = 1..20; {Data field length range for numeric procedures}
- FieldTxt = STRING[78];
-
- CONST
- {ASG exit codes; Inspect ASGExit to see how the procedure exited.}
- Aborted = -1; {ASG proc would not fit in window. Procedure aborted.}
- Undefined = 0; {you should never get this exit code}
- Tab = 9; {TAB key was pressed}
- Entered = 13; {ENTER was pressed or the field filled by the operator}
- ShTab = 15; {SHIFT TAB keys were pressed}
- Escaped = 27; {ESC key was pressed}
- Up = 72; {UP key or ^E was pressed}
- Down = 80; {DOWN key or ^X was pressed}
- ASGExit : INTEGER = Undefined;
- SpaceBarOK: BOOLEAN = True; { Space bar (dis)allowed in numeric procedures }
-
- VAR { The following 4 globals are automatically set to appropriate
- values but may be modified in your code. EG: SayAttr:=79 will dis-
- play the prompt as white on red, and GetAttr:=65 will display the
- entry field as blue on red (or underlined on a mono screen) }
- OrgAttr { Text attribute before entering (and after exiting) an ASG proc }
- SayAttr, { Text attribute of prompt }
- GetAttr, { Text attribute of entry field during editing }
- EndAttr, { Text attribute of entry field after exiting }
- : BYTE;
-
- (* BOOLEAN PROCEDURE *)
-
- PROCEDURE
- AtSayGetBoolean(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetB :BOOLEAN); {Boolean variable; See comments at end of doc}
-
- (* CHARACTOR PROCEDURE - new to Version 5.2 *)
-
- PROCEDURE
- AtSayGetCharPic(X :Xrange ;
- Y :Yrange ;
- Prompt:FieldTxt; {text of prompt}
- VAR GetC :CHAR ; {charactor variable}
- Pic :CHAR ); {(see comments on Pic in AtSayGetStrPic below)}
-
- (* STRING PROCEDURES *)
-
- PROCEDURE
- AtSayGetStrLen(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetStr:FieldTxt; {string variable being entered}
- Len :BYTE ); {allowed field length of entry}
-
- PROCEDURE
- AtSayGetStrPic(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt ; {text of prompt}
- VAR GetStr:FieldTxt ; {string variable being entered}
- Pic :FieldTxt); {picture template}
-
- {Special PICture charactors:
- ! converts letters to uppercase
- # restricts entry to numbers, spaces, signs
- 9 restricts entry to numbers and signs
- A restricts entry to alphabetic charactors
- N restricts entry to letters and numbers
- X allows any charactor}
-
-
- (* NUMERIC PROCEDURES *)
-
- PROCEDURE
- AtSayGetReal(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetR :REAL ; {Real numeric variable being entered}
- FldLen:MaxFL ; {Length of entry field}
- DecPl :INTEGER); {decimal places}
-
- PROCEDURE
- AtSayGetLongInt(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetLI :LONGINT ; {LongInt numeric variable being entered}
- FldLen:MaxFL ); {Length of entry field (FldLen>10 is useless)}
-
- PROCEDURE
- AtSayGetInt(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetInt:INTEGER ; {Integer numeric variable being entered}
- FldLen:MaxFL ); {Length of entry field. (FldLen>6 is useless)}
-
- PROCEDURE
- AtSayGetWord(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetW :WORD ; {Word numeric variable being entered}
- FldLen:MaxFL ); {Length of entry field. (FldLen>5 is useless)}
-
-
-
- The all new AtSayGetRange procedures shell around the AtSayGet numeric
- procedures (which are but shells around the AtSayGetStrPic string procedure).
- Using the AtSayGetRange procedures let you to specify a minimum and maximum
- allowable range of input. There are 4 Range procedures which all follow the
- syntax of their corresponding ASG numeric procedures except that they require
- two additional parameters: the first is the Minimum allowed range and the 2nd
- is the Maximum allowed range.
-
- PROCEDURE
- AtSayGetRealRange(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetR :REAL ; {numeric variable being entered}
- FldLen, {allowed field length of entry}
- DecPl :MacFL ; {decimal places}
- Min, {minimum acceptable value}
- Max :REAL ); {maximum acceptable value}
-
- PROCEDURE
- AtSayGetLongIntRange(AtX :Xrange ; {X coordinate}
- AtY :Yrange ; {Y coordinate}
- Say :FieldTxt; {text of prompt}
- VAR GetLI :LONGINT ; {numeric variable being entered}
- FldLen:MaxFL ; {allowed field length of entry}
- Min, {minimum acceptable value}
- Max :LONGINT); {maximum acceptable value}
-
- PROCEDURE
- AtSayGetIntRange(X :Xrange ; {X coordinate}
- Y :Yrange ; {Y coordinate}
- Prompt:FieldTxt; {text of prompt}
- VAR GetI :INTEGER ; {numeric variable being entered}
- FldLen:MaxFL ; {allowed field length of entry}
- Min, {minimum acceptable value}
- Max :INTEGER); {minimum acceptable value}
-
- PROCEDURE
- AtSayGetWordRange(X :Xrange ; {X coordinate}
- Y :Yrange ; {Y coordinate}
- Prompt:FieldTxt; {text of prompt}
- VAR GetW :WORD ; {numeric variable being entered}
- FldLen:MaxFL ; {allowed field length of entry}
- Min, {minimum acceptable value}
- Max :WORD ); {minimum acceptable value}
-
- Finally, the simple AtSay procedure used by all of the above has been in-
- terfaced. If you are using the procedures in this unit you might as well use
- AtSay rather than GoToXY(x,y); WRITE('Something to say');
-
- PROCEDURE AtSay(X :Xrange ;
- Y :Yrange ;
- Prompt:FieldTxt); {Prompt is displayed according to SayAttr}
-
- EDITING KEYS
-
- When you are positioned in a data field certain keys and combinations
- of keys will facilitate editing. If the operator is familiar with dBase or
- WordStar (s)he will find that the editing keys noted below are very similar.
-
- Key(s) Function ASGExit
- -------------- -------------------------------------------------- -------
- <-, ^S . . . Move cursor one character to the left. 0
- ->, ^D . . . Move cursor one character to the right. 0
- ^ <-, ^A . . . Move cursor one word to the left. 0
- ^ ->, ^F . . . Move cursor one word to the right. 0
- Home, ^Z . . . Move to the start of the field. 0
- End, ^B . . . Move to the last character in the field. 0
- Del, ^G . . . Delete the character at the cursor position and
- pull over all the characters on the right. 0
- ^T . . . . . . Delete word to right and pull over remaining text. 0
- ^Y . . . . . . Delete the whole field. 0
- ^R . . . . . . Restore field to its original state before edit. 0
- BackSpace . . Delete the character to the left of the cursor and
- pull over all the characters on the right. 0
- Ins, ^V . . . Toggles insert on/off. Block cursor for insert mode. 0
- SpaceBar . . . Move cursor to the right. If insert is off it will
- over-write any characters, otherwise it will push them
- to the right as it moves. 0
- Tab . . . . . Accepts the field and exits if the entry is valid. 9
- Enter . . . . " " " " " " " " " " 13
- Shift Tab . . " " " " " " " " " " 15
- Esc . . . . . Exits procedure abandoning any edits that were made 27
- UP, ^E . . . Accepts the field and exits if the entry is valid. 72
- DOWN, ^X . . . " " " " " " " " " " 80
-
- SPECIAL CONSIDERATIONS:
-
- Compiler Settings:
- Programs using the AtSayGet or ASGRange units must be compiled with the
- Options/Compiler/Var-string checking as RELAXED, or include the {$V-} compiler
- directive.
-
- Initialization of variables:
- All formal variable parameters passed to one of the AtSayGet pro-
- cedures should first be properly initialized as the current value of the
- variable will be displayed in the data field. For example, if you are using
- the AtSayGetStrLen procedure to enter a new STRING[10] variable without first
- properly initializing the variable with an actual or nul value, 10 "random"
- charactors will be displayed in the entry field until a ^Y is issued or the
- field is filled with data by the operator.
- Special care must taken with variables passed to the AtSayGetStrPic
- procedure to initialize the formal variable with the exact length of spaces
- or text equal to SizeOf(GetStr).
- When using an AtSayGet procedure to enter numeric data you will also wish
- to initialize the variable. All numerals in the entry field, even if they are
- seperated with spaces, will compose the value passed by the procedure. Thus,
- in a field the length of 4 the entry [12_0] will be returned as [ 120]. This
- is different than the way dBase accepts numeric input (which, in this example,
- would return [ 12] ).
-
- Screen considerations:
- Unlike some other line editors the prompts in these AtSayGet procedures
- are positioned on the screen in the normal Pascal X,Y (column,row) format. The
- dBase style Y,X (row,column) positioning is fine for dBase programmers but we
- use Pascal and should maintain consistency in conventions.
- All of the AtSayGet procedures work equally well on either a mono or color
- display. With a color display the procedures automatically adapt to the back-
- ground color and display the prompt and field in an appropriate color. The de-
- fault colors c/b altered by changing the global variables SayAttr & GetAttr.
- The AtSayGet string procedures indicate insert mode with a block cursor
- and overwrite mode with a normal cursor. Upon exit the cursor is set to the
- default state for the type of monitor being used. Thus, if you have entered an
- AtSayGet procedure with a modified cursor and you want it the same after exit-
- ing, you will have to re-modify the cursor in your subsequent code.
- Note that the maximum X-coordinate is 79 and the maximum Y-coordinate is
- 25. Nevertheless, these procedures will not wrap on the screen, but rather will
- just exit without doing anything if (X+Length(Prompt)+[field length]) > 80.
- Likewise, when an AtSayGet procedure is used in a window that is narrower than
- 80 the procedure will exit without running if it would otherwise wrap in the
- window. In either case ASGExit is set to Aborted (-1).
-
- Range checking:
- Numeric range checking routines are incorporated within the AtSayGet
- numeric procedures. Thus, if the operator enters a negative number in a
- AtSayGetWord field the bell will ring and the message ERROR will be briefly
- displayed.
- The RANGE clause of dBase was emulated by writing a shell around the
- AtSayGet numeric procedures. With an AtSayGetRange procedure an entry that is
- too small will sound the bell, briefly fill the field with <<<<<<<..., and re-
- set the field to the minimum allowed range. If the entry is too large the bell
- sounds, the field is briefly filled with >>>>>>>..., and the field reset to the
- maximum allowed value. The procedure will not exit until a valid range is
- entered. If you program an illogical range (EG: 70000,-5 in AtSayGetWordRange)
- a compiler range error or run-time range error will be generated.
-
- Valid AtSayGetBoolean enteries:
- Affirmative entries are: '+','t','T','y','Y'
- Negative entries are: '-','f','F','n','N'
-
- Demonstration of procedures:
- Compile and run DEMO.PAS to see how the procedures in this unit can
- be used. When looking at the code notice how the variables are initialized.
-
- * * * * * * * * * * * * * * * * * * * * * * * * *
-
-
-
- ----------------end-of-author's-documentation---------------
-
- Software Library Information:
-
- This disk copy provided as a service of
-
- The Public (Software) Library
-
- We are not the authors of this program, nor are we associated
- with the author in any way other than as a distributor of the
- program in accordance with the author's terms of distribution.
-
- Please direct shareware payments and specific questions about
- this program to the author of the program, whose name appears
- elsewhere in this documentation. If you have trouble getting
- in touch with the author, we will do whatever we can to help
- you with your questions. All programs have been tested and do
- run. To report problems, please use the form that is in the
- file PROBLEM.DOC on many of our disks or in other written for-
- mat with screen printouts, if possible. The P(s)L cannot de-
- bug programs over the telephone.
-
- Disks in the P(s)L are updated monthly, so if you did not get
- this disk directly from the P(s)L, you should be aware that
- the files in this set may no longer be the current versions.
-
- For a copy of the latest monthly software library newsletter
- and a list of the 1,800+ disks in the library, call or write
-
- The Public (Software) Library
- P.O.Box 35705 - F
- Houston, TX 77235-5705
- (713) 665-7017
-